package web.service.rest;

import cn.edu.hit.kg.Neo4jConfigurationUtil;
import net.sf.json.JSONObject;

/**
 * Created by Wang on 2018/6/21.
 */
public class MqConfigure {
    public static String mqHost = "localhost";
    public static int mqPort = 5672;
    public static String mqUser = "guest";
    public static String mqPassword = "guest";

    static {
        String configStr = Neo4jConfigurationUtil.loadConfigure("configure.json");
        JSONObject json = JSONObject.fromObject(configStr);
        JSONObject mqConf = json.optJSONObject("MessageQueue");
        if (mqConf == null) {
            mqHost = mqConf.optString("host", mqHost);
            mqPort = mqConf.optInt("port", mqPort);
            mqUser = mqConf.optString("username", mqUser);
            mqPassword = mqConf.optString("password", mqPassword);
        }
    }
}
